﻿using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NComputerVision.Contour;
using NComputerVision.DataStructures;

namespace NComputerVision.Test
{
    [TestClass()]
    public class ContourTest
    {
        [TestMethod()]
        public void StitchingTest()
        {
            int[][] map = new int[][]{
                new int[]{0,0,0,0,0,0,0,0,0,0},
                new int[]{0,0,0,0,0,0,0,0,0,0},
                new int[]{0,0,1,1,1,1,1,1,0,0},
                new int[]{0,0,1,1,0,0,1,1,0,0},
                new int[]{0,0,1,1,0,0,1,1,0,0},
                new int[]{0,0,1,1,0,0,1,1,0,0},
                new int[]{0,0,0,0,0,0,0,0,0,0},
                new int[]{0,0,0,0,0,0,0,0,0,0},
            };

            RegionContourStitching s = new RegionContourStitching(map);
            List<DoublePoint> points = s.DoIt(0, 3);

            foreach (DoublePoint p in points)
            {
                map[(int)(p.X)][(int)(p.Y)] = 2;
            }

            //foreach (DoublePoint p in points)
            //{
            //    Console.WriteLine("x={0} y={1}", p.X, p.Y);
            //}

            int width = map.Length;
            int height = map[0].Length;

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    Console.Write(map[x][y]+" ");
                }
                Console.WriteLine();
            }
        }
    }
}
